package cn.project.lemontree.service.impl;

import cn.project.lemontree.bean.Task;
import cn.project.lemontree.service.TaskService;
import cn.project.lemontree.dao.TaskDao;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class TaskServiceImpl extends ServiceImpl<TaskDao,Task> implements TaskService {
    @Resource
    private TaskDao taskDao;

    @Override
    public List<Task> listpage(int page, int size, String teacherName,String theme) {
        return taskDao.listPage((page-1)*size,size,teacherName,theme);
    }

    @Override
    public int count( String teacherName,String theme) {
        return taskDao.count(teacherName,theme);
    }

    @Override
    public boolean saveTask(Task task) {
        return taskDao.save(task)>0;
    }

    @Override
    public boolean updateTask(Task task) {
        return taskDao.update(task)>0;
    }

    @Override
    public List<Task> regain(String ddesc, String theme){
        return taskDao.regain(ddesc,theme);
    }

    @Override
    public List<Task> getMyTask(int page,int size,Integer teacherId,String theme){
        return taskDao.getMyTask(page,size,teacherId,theme);
    }

    @Override
    public int countMyTask(Integer teacherId,String theme){
        return taskDao.countMyTask(teacherId,theme);
    }
}
